package net.sf.calibur.transport.message;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

public class RequestSessionMessage extends Message {
	private long requestTimestamp;
	
	public RequestSessionMessage() {
		super(Message.MT_REQUEST_SESSION);
		this.requestTimestamp = System.currentTimeMillis();
	}

	public long getRequestTimestamp() {
		return requestTimestamp;
	}

	public void setRequestTimestamp(long requestTimestamp) {
		this.requestTimestamp = requestTimestamp;
	}

	@Override
	public void serialize(OutputStream output) throws Exception {
		DataOutputStream dos = new DataOutputStream(output);
		dos.writeLong(requestTimestamp);
		dos.flush();
	}

	@Override
	public void deserialize(InputStream input) throws Exception {
		DataInputStream dis = new DataInputStream(input);
		requestTimestamp = dis.readLong();
	}
}
